# 判断分数
# try:
#     score = int(input('请输入分数：'))
#     if score >= 0 and score <= 100:
#         print('分数为：', score)
#     else:
#         raise Exception('分数不正确')
# except Exception as e:
#     print(e)


# # 判断三角形是否成立
# try:
#     a = int(input('请输入第一条边：'))
#     b = int(input('请输入第二条边：'))
#     c = int(input('请输入第三条边：'))
#     # 两小边之和大于最大边即可
#     if (a + b) > c and (a + c) > b and (b + c) > a:
#         print('三角形的边长为：a = {0}, b = {1}, c = {2}'.format(a, b, c))
#     else:
#         raise Exception('a = {0}, b = {1}, c = {2}, 不能构成三角形'.format(a, b, c))
# except Exception as e:
#     print(e)


# 函数的定义与使用
def get_sum (a, b):
    # 找出最小值
    min = a if a < b else b
    max = 0
    if a == min:
        max = b
    else:
        max = a
    # 开始遍历求和
    sum = 0
    temp = min
    while temp != max+1:
        sum += temp
        temp += 1
    # 打印计算结果
    print('从{0}到{1}的和为：{2}'.format(min, max, sum))

# 调用函数
get_sum(1,100)
get_sum(100,1)